﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace HugeFlow.CommandPattern.Commands
{
    /// <summary>
    /// class for Command and CommandParameter's binding
    /// </summary>
    internal abstract class CommandBinderBase : FrameworkElement, ICommand
    {
        #region InstantCommandParameter
        /// <summary> 
        /// Gets or sets the InstantCommandParameter possible Value of the object object.
        /// </summary> 
        public object InstantCommandParameter
        {
            get { return (object)GetValue(InstantCommandParameterProperty); }
            set { SetValue(InstantCommandParameterProperty, value); }
        }

        /// <summary> 
        /// Identifies the InstantCommandParameter dependency property.
        /// </summary> 
        public static readonly DependencyProperty InstantCommandParameterProperty =
                    DependencyProperty.Register(
                          "InstantCommandParameter",
                          typeof(object),
                          typeof(CommandBinderBase),
                          null);
        #endregion InstantCommandParameter

        #region Constructors

        public CommandBinderBase()
        {
            this.Visibility = Visibility.Collapsed;
        }

        #endregion Constructors

        #region ICommand Members

        public abstract bool CanExecute(object parameter);

        public event EventHandler CanExecuteChanged;

        public abstract void Execute(object parameter);
        #endregion
    }
}
